url = '/:slug|sendorderemail-\d+.html$'
description = '订单发送邮件'
is_hidden = 0
layout = 'default_email'
[session]
security = "user"
redirect = "account/login"
==
use Jason\Ccshop\Controllers\Orders;
function onStart() {
    header("Content-type: text/html; charset=utf-8");
    $userid_login = $this['user']['attributes']['id'];

    $slugArr = explode('-', str_replace('.html', '', $this->param('slug')));
    $sn = $slugArr['1'];
    $order = (new Orders())->orderDetail($sn);
    $userid_order = $order['attributes']['uid'];
    if($order == null){
        return redirect('/account/login.html');
    }
    if($userid_order != $userid_login){
        return redirect('/account/login.html');
    }
    $this['email'] = $this['user']['attributes']['email'];
    $this['orderStatusCode'] = $order->order_status->code;
    $this['order'] = $order;
    $this['previousUrl'] = Url::previous();
}
==
<div class="main-container col2-right-layout">
  <div class="main container">
    <div class="row">
            <div id="jp_jean" class="xans-element- xans-product xans-product-menupackage ">
                <div class="xans-element- xans-product xans-product-headcategory title ">
                    <p class="banner"></p>
                </div>
            </div>
            <div class="page-title">
                <h1>メールアドレス</h1>
            </div>
            {{ form_ajax('onSendOrderEmail', { class: 'form-send-email',
            redirect:previousUrl }) }}
            <div class="updata_newdress">
                <ol class="one-page-checkout" id="checkoutSteps">
                    <li id="opc-shipping" class="section allow">
                        <div id="checkout-step-billing" class="a-item">
                            <fieldset class="group-select">
                                <ul>
                                    <li id="shiping-address-form" >

                                        <input type="hidden" name="sn" value="{{ order.sn ? order.sn : '' }}"/>
                                        <input type="hidden" name="type" value="pc"/>

                                        <ul>
                                            <li>
                                                <div class="customer-name">
                                                    <div class="input-box">
                                                        <label for="email"> メールアドレス<span class="required">* </span></label>
                                                        <input type="text" class="form-control" id="email" name="email"
                                                               value="{{ email }}"
                                                               placeholder="" class="input-text required-entry"
                                                               required>
                                                    </div>
                                                </div>
                                            </li>

                                            <li>
                                                <div class="customer-name">
                                                    <div class="input-box">
                                                        <label for="title"> タイトル<span class="required">* </span></label>
                                                        <input type="text" class="form-control" id="title" name="title"
                                                               value="" type="text" maxlength="255" 
                                                               placeholder="メールアドレス" class="input-text required-entry"
                                                               required>
                                                    </div>
                                                </div>
                                            </li>


                                        </ul>

                                    </li>
                                </ul>
                            </fieldset>
                        </div>
                    </li>
                </ol>
            </div>

            <div class="customer-name">
                <textarea id='edit' name="content" style="margin-top: 30px;"></textarea>
            </div>

            <div class="updata_newdress" style="margin-top:5px;">
                <ol class="one-page-checkout">
                    <li class="section allow">
                        <div class="a-item">
                            <fieldset class="group-select">
                                <ul>
                                    <li>
                                        <button class="btn btn-black pull-left" style="float:left" type="submit">
                                            <span>送信する</span>
                                        </button>
                                        <button type="button" onclick="history.go(-1);return false;" class="btn btn-default xin_cancel">キャンセル</button>
                                    </li>
                                </ul>
                            </fieldset>
                        </div>
                    </li>
                </ol>
            </div>
            {{ form_close() }}

        </div>
    </div>
</div>

{% put styles %}
<link type="text/css" rel="stylesheet" href="{{ 'assets/css/ueditor/font-awesome.css'|theme }}" />
<link type="text/css" rel="stylesheet" href="{{ 'assets/css/ueditor/froala_editor.css'|theme }}" />
{% endput %}

{% put scripts %}
<script src="{{ 'assets/js/ueditor/js/froala_editor.min.js'|theme }}"></script>
<!--[if lt IE 9]>
<script src="{{ 'assets/js/ueditor/js/froala_editor_ie8.min.js'|theme }}"></script>
<![endif]-->
<script src="{{ 'assets/js/ueditor/js/plugins/tables.min.js'|theme }}"></script>
<script src="{{ 'assets/js/ueditor/js/plugins/lists.min.js'|theme }}"></script>
<script src="{{ 'assets/js/ueditor/js/plugins/colors.min.js'|theme }}"></script>
<script src="{{ 'assets/js/ueditor/js/plugins/media_manager.min.js'|theme }}"></script>

<script src="{{ 'assets/js/ueditor/js/plugins/font_family.min.js'|theme }}"></script>
<script src="{{ 'assets/js/ueditor/js/plugins/font_size.min.js'|theme }}"></script>
<script src="{{ 'assets/js/ueditor/js/plugins/block_styles.min.js'|theme }}"></script>
<!--<script src="{{ 'assets/js/ueditor/js/plugins/video.min.js'|theme }}"></script>-->
<script src="{{ 'assets/js/ueditor/js/langs/ja.js'|theme }}"></script>

<script>
    $(function () {
        $('#edit').editable({
            inlineMode: false, alwaysBlank: true,
            language: "ja",
            height: '400px',
            theme: 'gray',
            buttons:["bold","italic","underline","strikeThrough","fontSize","fontFamily","color","sep","formatBlock","blockStyle","align","insertOrderedList","insertUnorderedList","outdent","indent","sep","createLink","insertHorizontalRule","undo","redo"],
            imageUploadURL: 'richeditor/uploadimage',//上传到本地服务器
            imageDeleteURL: 'richeditor/deleteimage',//删除图片
            imagesLoadURL: 'richeditor/loadimages'//管理图片
        }).on('editable.imageInserted', function (e, editor){
            var imageUrls = '';
            $(".froala-element img[data-fr-image-preview]").each(function(){
                imageUrls =  imageUrls + (imageUrls ? (','+$(this).attr('src')) : $(this).attr('src'));
            });
            editor.options.imagesLoadParams = {imageUrls: imageUrls};
        }).on('editable.afterRemoveImage', function (e, editor, $img) {// Set the image source to the image delete params.        
            editor.options.imageDeleteParams = {src: $img.attr('src')};// Make the delete request
            editor.deleteImage($img);
        });
    });
</script>
{% endput %}